# NLTK: Doctest Makefile
#
# Copyright (C) 2001-2010 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
#         Steven Bird <sb@csse.unimelb.edu.au>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT

# File locations:

.SUFFIXES: .rst .errs .html
.PHONY: all html errs

DOCTESTS = $(wildcard *.rst)
HTML = $(DOCTESTS:.rst=.html)
ERRS = $(DOCTESTS:.rst=.errs)
PYTHON = python
DOCTEST = $(PYTHON) ../util/doctest_driver.py
DOCTEST_FLAGS = --udiff
RST2HTML = python ../util/rst.py --html --css nltkdoc.css

.rst.errs:
	python ../util/doctest_driver.py $< > $@

.rst.html:
	$(RST2HTML) $< -o $@

all: html errs
html: $(HTML)
errs: $(ERRS)
	@echo Failed doctests:
	@grep 'FAILED (failures' *.errs |sed 's/\(.*\)\.errs:.*/  - \1/'

clean:
	rm -f `find . -name '*.html'`
	rm -f `find . -name '*.errs'`

publish:
	svn add $HTML
	python ../util/svnmime.py $HTML
